<template>
  <div>
      <!--本体列表，数据 -->
      <div class="table-body">
        <div class="table-body-box">
          <el-table
              ref="multipleTable"
              :data="arryList"
              :stripe="tableStyle.tableStripe"
              :border="tableStyle.tableBorder"
              tooltip-effect="dark"
              header-cell-class-name="table-text-c"
              style="width: 100%">
            <el-table-column
                prop="id"
                label="ID"
                align="center"
                width="90"
                :key="1">
            </el-table-column>
            <el-table-column
                prop="name"
                label="请批人"
                :show-overflow-tooltip="true"
                align="center"
                :key="2">
              <template slot-scope="scope">
                {{ scope.row.user ? scope.row.user.realname : '' }}
              </template>
            </el-table-column>
            <el-table-column
                prop="create_time"
                label="请批时间"
                align="center"
                width="110"
                :key="3">
            </el-table-column>
            <el-table-column
                label="文宣用途"
                align="center"
                prop="purpose"
                :show-overflow-tooltip="true"
                :key="4">
            </el-table-column>
            <el-table-column
                prop="cycle"
                label="文宣周期"
                align="center"
                width="110"
                :key="5">
            </el-table-column>
            <el-table-column
                label="文宣用途说明"
                prop="content"
                align="center"
                :show-overflow-tooltip="true"
                width="150"
                :key="8">
            </el-table-column>
            <el-table-column
                label="我的批复"
                prop="content"
                align="center"
                :show-overflow-tooltip="true"
                width="90"
                v-if="Number(searchData.style)==3"
                :key="9">
              <template slot-scope="scope">
                <span :style="{color:scope.row.sign_state==1?'green':'red' }">{{
                    signState[scope.row.sign_state]
                  }}</span>
              </template>
            </el-table-column>
            <el-table-column
                label="集体决策"
                align="center"
                width="90"
                v-if="Number(searchData.style)!==3"
                :key="10">
              <template slot-scope="scope">
                <el-popover
                    placement="left-start"
                    title="会议人员"
                    width="250"
                    v-if="scope.row.is_meeting==1"
                    trigger="hover">
                  <div class="tableline">
                    <div class="list" v-for="item in scope.row.sign">
                      <p>{{ item.user.realname }}：
                        <i :style="{color: item.status?'green':'red'}">{{ item.status ? '已确认' : '未确认' }}</i></p>
                    </div>
                  </div>
                  <span slot="reference" class="tablelineBtn">
                    查看
                  </span>
                </el-popover>
                <span v-else>无会议</span>
              </template>
            </el-table-column>
            <el-table-column
                label="园长审批"
                align="center"
                width="90"
                :key="11">
              <template slot-scope="scope">
                <span v-if="scope.row.status!==3 && scope.row.status!==4" style="color: red">待审批</span>
                <span v-if="scope.row.status==3" style="color: green">园长通过</span>
                <span v-if="scope.row.status==4" style="color: red">园长驳回</span>
              </template>
            </el-table-column>
            <el-table-column
                prop="status"
                label="申请部门"
                align="center"
                width="80"
                :key="12">
              <template slot-scope="scope">
                {{ scope.row.department ? scope.row.department.name : '' }}
              </template>
            </el-table-column>
            <el-table-column
                prop="status"
                label="操作"
                align="center"
                width="150"
                fixed="right"
                :key="13">
              <template slot-scope="scope">
                <el-button size="mini" @click="godeDetail(scope.row)">
                  详情
                </el-button>
                <el-button size="mini" @click="examinBtn(scope.row)" plain type="danger"
                           v-if="Number(searchData.style)!==3">
                  删除
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </div>
    </div>
</template>

<script>
import {pagination, tableoption} from '@/utils/util.js'
import {approveIndex, approveDelete} from '@/api/admin/approveApply'
import {departmentIndex} from '@/api/admin/system'
import {mapGetters} from "vuex";

export default {
  props:['arryList'],
  components: {
  },
  data() {
    return {
      applyDetailId: false,
      addVisible: false,
      handleSelection: [],
      // 设置table样式
      tableStyle: tableoption,
      // 设置table页面分页所需
      page: {
        pageindex: pagination.pageIndex,
        pagesize: pagination.pageSize,
        total: pagination.total
      },
      iframeSrc: '',
      previewVisible: '',
      number: null,
      searchData: {
        p: 1,
        style: '1', // 1 我的 2 园长 3 会议
        department_id: '',
        start_time: '',
        end_time: '',
      },
      // <!--        0 待审核 1 会议通过 2 会议驳回 3 园长通过 4 园长驳回-->
      value: '1',
      addtime: '',
      tabType: '0',
      detailVisible: null,
      detailId: 0,
      flowName: '',
      flowList: [],
      statusLine: [
        {
          id: 1,
          name: '我的请批申请'
        },
        {
          id: 3,
          name: '我的集体决策'
        }
      ],
      signState: {
        0: '待确认',
        1: '已通过',
        2: '已驳回',
      },
      examingUser: {
        0: '待审核',
        1: '会议通过',
        2: '会议驳回',
        3: '园长通过',
        4: '园长驳回'
      },
      departmentList: []
    }
  },
  computed: {
    ...mapGetters(['userInfo']),
  },
  watch: {
  },
  created() {
  },
  methods: {
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    handleClick(option) {
      if (Number(option.name) !== Number(this.searchData.type)) {
        this.searchData.type = option.name
        this.InitFn()
      }
    },
    examinBtn(option) {
      this.$emit('examinBtn',this.getJson(option))
    },
    // 分页
    handleSizeChange(val) {
      this.page.pageindex = val
      this.InitFn()
    },
    getJson(option) {
      return JSON.parse(JSON.stringify(option))
    },
    godeDetail(option) {
      this.$emit('godeDetail', this.getJson(option))
    }
  },
  mounted() {
  },
  // 缓存机制 end
}
</script>


<style scoped>

.wx-user-box-line img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  margin-right: 5px;
}

.wx-user-box-line {
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-wx {
  cursor: pointer;
  padding: 5px;
}

.btn-wx:hover {
  color: #1b8de5;
  text-decoration: underline;
}

.delet-wx {
  color: red;
  cursor: pointer;
}

.delet-wx:hover {
  text-decoration: underline;
}

.tab-body {
  display: flex;
  align-items: center;
}

.tab-box {
  flex: 1;
}

.tab-box-list {
  display: flex;
  align-items: center;
}

.examinBtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: red;
}

.examinBtn i {
  font-style: normal;
  color: #1b8de5;
  cursor: pointer;
  font-size: 12px;
}

.tableline .list {
  font-size: 12px;
}

.tableline .list i {
  font-style: normal;
}

.url-box-line {
  display: flex;
  align-items: center;
  color: #3e89ff;
}

.url-box-line:hover {
  text-decoration: underline;
}

.url-box-line .url-box-line-a {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.examine-list {
  display: flex;
  padding: 10px 0;
}

.examine-list-title {
  width: 85px;
}

.examine-list-user {
  flex: 1;
}
</style>
